package day20171215;

import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test {
    public static void main(String[] args) {
        Map<String, Integer> map=new HashMap<>();
        try {
            BufferedReader bufferedReader=new BufferedReader(new FileReader("D:\\name.txt"));
           String sno=null;

            while ((sno=bufferedReader.readLine())!=null){
                map.put(sno,0);
            }
            File file=new File("D:\\16作业");
            File[] files=file.listFiles();
            //遍历文件夹下的每一个文件
            for (File f:files){
                String filename=f.getName();
                Matcher matcher= Pattern.compile("信本1班(\\d+)").matcher(filename);
                while (matcher.find()){
                    System.out.println(matcher.group(1));
                    if (sno==matcher.group(1)){
                        map.put(sno, map.get(sno) + 1);
                }
                }
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {

        }
    }


}
